import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '订单号',
    align: "center",
    dataIndex: 'orderNo'
  },
  {
    title: '保单号',
    width: 240,
    align: "center",
    dataIndex: 'policyNo'
  },
  {
    title: '订单来源',
    align: "center",
    dataIndex: 'sourceType_dictText'
  },
  {
    title: '保险状态',
    align: "center",
    dataIndex: 'policyState_dictText'
  },
  {
    title: '支付时间',
    align: "center",
    dataIndex: 'payTime'
  },
  {
    title: '付款人名称',
    align: "center",
    width: 200,
    dataIndex: 'payAccountName'
  },
  {
    title: '出保时间',
    align: "center",
    dataIndex: 'insureActiveDate'
  },

  {
    title: '保费',
    align: "center",
    dataIndex: 'cost'
  },
  {
    title: '订单归属',
    align: "center",
    dataIndex: 'owners'
  },
  {
    title: '渠道商',
    align: "center",
    dataIndex: 'channelProvider'
  },
  {
    title: '地区',
    align: "center",
    dataIndex: 'area_dictText'
  },
  {
    title: '平台',
    align: "center",
    dataIndex: 'platformCode_dictText'
  },
  {
    title: '保险公司',
    align: "center",
    dataIndex: 'insuranceCompany_dictText'
  },
  {
    title: '被保人',
    align: "center",
    dataIndex: 'insuredName'
  },
  {
    title: '投保人名称',
    align: "center",
    dataIndex: 'policyHolderName'
  },
  {
    title: '项目名称',
    align: "center",
    dataIndex: 'projectName'
  },
  {
    title: '项目编号',
    align: "center",
    dataIndex: 'projectId'
  },
  {
    title: '保证金',
    align: "center",
    dataIndex: 'margin'
  },
  {
    title: '邀请码',
    align: "center",
    dataIndex: 'inviteCode'
  },
  {
    title: '开标时间',
    align: "center",
    dataIndex: 'kaiBiaoTime'
  },

];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "订单号",
    field: 'orderNo',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "保单号",
    field: 'policyNo',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "订单来源",
    field: 'sourceType',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "保险状态",
    field: 'policyState',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "支付时间",
    field: "payTime",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "付款人名称",
    field: 'payAccountName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "出保时间",
    field: "insureActiveDate",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "渠道商",
    field: 'channelProvider',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "地区",
    field: 'area',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
  {
    label: "平台",
    field: 'platformcode',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
  {
    label: "保险公司",
    field: 'insuranceCompany',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
  {
    label: "被保人",
    field: 'insuredName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "投保人名称",
    field: 'policyHolderName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "项目名称",
    field: 'projectName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "项目编号",
    field: 'projectId',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "邀请码",
    field: 'inviteCode',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '订单号',
    field: 'orderNo',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入订单号!'},
             ];
    },
    dynamicDisabled: true
  },
  {
    label: '保单号',
    field: 'policyNo',
    component: 'Input',
    dynamicDisabled: true
  },
  {
    label: '订单来源',
    field: 'sourceType',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入订单来源!'},
             ];
    },
    dynamicDisabled: true
  },
  {
    label: '保险状态',
    field: 'policyState',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保险状态!'},
             ];
    },
  },
  {
    label: '支付时间',
    field: 'payTime',
    component: 'DatePicker',
  },
  {
    label: '付款人名称',
    field: 'payAccountName',
    component: 'Input',
  },
  {
    label: '出保时间',
    field: 'insureActiveDate',
    component: 'DatePicker',
  },
  {
    label: '保费',
    field: 'cost',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保费!'},
             ];
    },
  },
  {
    label: '保证金',
    field: 'margin',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入保证金!'},
      ];
    },
  },
  {
    label: '渠道商',
    field: 'channelProvider',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入渠道商!'},
             ];
    },
  },
  {
    label: '地区',
    field: 'area',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
  {
    label: '平台',
    field: 'platformcode',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入平台!'},
             ];
    },
  },
  {
    label: '保险公司',
    field: 'insuranceCompany',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保险公司!'},
             ];
    },
  },
  {
    label: '被保人',
    field: 'insuredName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入被保人!'},
             ];
    },
  },
  {
    label: '投保人名称',
    field: 'policyHolderName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入投保人名称!'},
             ];
    },
  },
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目名称!'},
             ];
    },
  },
  {
    label: '项目编号',
    field: 'projectId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目编号!'},
             ];
    },
  },
  {
    label: '邀请码',
    field: 'inviteCode',
    component: 'Input',
  },
  {
    label: '业务流水号',
    field: 'applyNo',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入业务流水号!'},
             ];
    },
  },
  {
    label: '下单时间',
    field: 'applyTime',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入下单时间!'},
             ];
    },
  },
  {
    label: '投保联系人名称',
    field: 'policyLinkmanName',
    component: 'Input',
  },
  {
    label: '投保联系人手机号',
    field: 'policyLinkmanMobilename',
    component: 'Input',
  },
  {
    label: '费率',
    field: 'rate',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入费率!'},
             ];
    },
  },
  {
    label: '投保人社会统一信用代码',
    field: 'policyUcc',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入投保人社会统一信用代码!'},
             ];
    },
  },
  {
    label: '保险天数',
    field: 'policyDays',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保险天数!'},
             ];
    },
  },
  {
    label: '开标时间',
    field: 'kaiBiaoTime',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入开标时间!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
